DRAW_DINO:
	; clear the y register
	LDY #$00
	; handle jump status first
	; do jump or drop
	LDA VAR_DINO_STATUS
	CMP #DINO_STATUS_JUMPING
	BEQ DINO_DO_JUMP
	CMP #DINO_STATUS_DROPPING
	BEQ DINO_DO_DROP
	JMP DINO_DO_ANIMATION


DINO_DO_JUMP:
	; minus velocity
	LDA VAR_DINO_VELOCITY
	SBC #DINO_DROP_STEP
	STA VAR_DINO_VELOCITY

	CMP #$00
	BNE DINO_JUMP_UP
	LDA #DINO_STATUS_DROPPING
	STA VAR_DINO_STATUS
	JMP DINO_DO_ANIMATION


DINO_JUMP_UP:
	LSR
	LSR
	STA VAR_DINO_VELOCITY_SLOW

	MACRO_DINO_SUB_Y VAR_DINO_VELOCITY_SLOW
	JMP DINO_DO_ANIMATION


DINO_DO_DROP:
	LDA SPRITE_DINO
	CMP #GRD_POS_Y
	BNE DD_DROP_DOWN
	LDA #DINO_STATUS_STAND
	STA VAR_DINO_STATUS
	JMP DINO_DO_ANIMATION


DD_DROP_DOWN:
	; add velocity
	LDA VAR_DINO_VELOCITY
	ADC #DINO_DROP_STEP
	STA VAR_DINO_VELOCITY

	LSR
	LSR
	STA VAR_DINO_VELOCITY_SLOW

	MACRO_DINO_ADD_Y VAR_DINO_VELOCITY_SLOW
	JMP DINO_DO_ANIMATION

;-----------------------------------

DINO_DO_ANIMATION:
	LDA VAR_GAME_STATUS
	CMP #GAME_STATUS_INITIAL
	BEQ DRAW_DINO_END
	CMP #GAME_STATUS_OVER
	BEQ DRAW_DINO_END

	INC VAR_DINO_FRAME_COUNTER
	LDA VAR_DINO_FRAME_COUNTER
	CMP #DINO_INIT_ANIMATION_SPEED
	BEQ DINO_SWITCH_FRAME
	RTS

DINO_SWITCH_FRAME:
	LDA #$00
	STA VAR_DINO_FRAME_COUNTER
	LDA VAR_DINO_FRAME_INDEX
	CMP #$00
	BNE DINO_FRAME_0
	BEQ DINO_FRAME_1

DINO_FRAME_0:
	INC VAR_DINO_FRAME_INDEX
	LDA #DINO_TILE_FOOT_RIGHT_UP_1
	STA (SPRITE_DINO + DINO_TILE_OFFSET_FOOT_1)
	LDA #DINO_TILE_FOOT_RIGHT_UP_2
	STA (SPRITE_DINO + DINO_TILE_OFFSET_FOOT_2)
	RTS

DINO_FRAME_1:
	DEC VAR_DINO_FRAME_INDEX
	LDA #DINO_TILE_FOOT_LEFT_UP_1
	STA (SPRITE_DINO + DINO_TILE_OFFSET_FOOT_1)
	LDA #DINO_TILE_FOOT_LEFT_UP_2
	STA (SPRITE_DINO + DINO_TILE_OFFSET_FOOT_2)
	RTS

DRAW_DINO_END:
	RTS
